-ifndef(D).
-define(D(X), io:format("DEBUG ~p:~p ~p~n",[?MODULE, ?LINE, X])).
-endif.

-define(DUMP(F,B), file:write_file(F,list_to_binary(B))).


-define(AWS_EC2_SERVER,"ec2.amazonaws.com").
-define(AWS_EC2_URL,   "http://" ++ ?AWS_EC2_SERVER ++ "/").
-define(AWS_EC2_SSL,   "https://" ++ ?AWS_EC2_SERVER ++ "/").
-define(AWS_EC2_META_DATA_SERVER,"169.254.169.254").
-define(AWS_EC2_META_DATA_BASE_URL,"http://" ++ ?AWS_EC2_META_DATA_SERVER ++ "/").

-define(AWS_S3_SERVER, "s3.amazonaws.com").
-define(AWS_S3_URL,    "http://" ++ ?AWS_S3_SERVER ++ "/").
-define(AWS_S3_SSL,    "https://" ++ ?AWS_S3_SERVER ++ "/").
-define(AWS_SDB_SERVER,"sdb.amazonaws.com").
-define(AWS_SDB_URL,   "http://" ++ ?AWS_SDB_SERVER ++ "/").
-define(AWS_SDB_SSL,   "https://" ++ ?AWS_SDB_SERVER ++ "/").
-define(AWS_SQS_SERVER,"queue.amazonaws.com").
-define(AWS_SQS_URL,   "http://" ++ ?AWS_SQS_SERVER ++ "/").
-define(AWS_SQS_SSL,   "https://" ++ ?AWS_SQS_SERVER ++ "/").

-define(CURRENT_VERSION_EC2,"2008-05-05").

-record(aws_info,{
	name               = [],
	aws_access_key     = [],
	aws_secret_key_id  = [],
	aws_account_number = [],
	cert               = [],
	private_key        = []
	}).

-record(s3_command,{
	method = [],
	uri = [],
	uquery = [],
	sub_resource = [],
	headers = [],
	amazon_headers = [],
	content_type = [],
	body = [],
	host = [],
	bucket = [],
	signature = []
	}).











-record(ami_info,{
	image_id       = [],
	image_location = [],
	image_state    = [],
	image_owner_id = [],
	public         = [],
	arch           = [],
	image_type     = [],
	product_codes   = []
	}).

-record(ec2_error,{
	type = [],
	http_code = [],
	code = [],
	message = [],
	request_id = []
	}).


-record(run_instance,{
	image_id = [],
	min_count = 1,
	max_count = 1,
	key_name = [],
	security_groups = [],
	user_data = [],
	instance_type = "m1.small",
	placement = [],
	kernel_id = [],
	ramdisk_id = [],
	block_device_mapping_virtual_name = [],
	block_device_mapping_device_name = []
	}).

-record(console_output,{
	instance_id = [],
	timestamp = [],
	output = []
	}).




-record(instances,{
	reservation_id      = [],
	owner_id            = [],
	groups              = [],
	ami_launch_index    = [],
	dns_name            = [],
	image_id            = [],
	instance_id         = [],
	instance_state      = [], % pending, running, shutting-down, termianted
	instance_state_code = [], % 0, 16, 32, 48
	instance_type       = [],
	key_name            = [],
	kernel_id           = [],
	launch_time         = [],
	placement           = [],
	private_dns_name    = [],
	product_codes       = [],
	ramdisk_id          = [],
	reason              = []
	}).


-record(key_pair,{
	key_name = [],
	key_fingerprint = [],
	key_material = []	
	}).


-record(image_attributes,{
	image_id       = [],
	attribute      = 'launchPermission',
	operation_type = [],
	users          = [],
	groups         = [],
	product_code   = []
	}).


-record(volume_info,{
	volume_id = [],
	instance_id = [],
	device = [],
	volume_status = [],
	attach_time = [],
	size = [],
	create_time = [],
	availability_zone = [],
	snapshot_id = [],
	attach_status = [],
	attachments = []
	}).

-record(attach_info,{
	volume_id = [],
	instance_id = [],
	size = [],
	status = [],
	attach_time = []
	}).

-record(snapshot_info,{
	snapshot_id = [],
	volume_id = [],
	status = [],
	start_time = [],
	progress = []
	}).

-record(address_info,{
	instance_id = [],
	public_ip   = []
	}).

-record(zone_info,{
	zone_name = [],
	zone_state = []
	}).

-record(reservation_info,{
	reservation_id = [],
	owner_id = [],
	groups = [],
	instances = []
	}).

-record(instance_info,{
	ami_launch_index = [],
	dns_name = [],
	image_id = [],
	instance_id = [],
	instance_state_name = [],
	instance_state_code = [],
	shutdown_state_name = [],
	shutdown_state_code = [],
	previous_state_name = [],
	previous_state_code = [],
	instance_type = [],
	key_name = [],
	kernel_id = [],
	launch_time = [],
	placement = [],
	private_dns_name = [],
	product_codes = [],
	ramdisk_id = [],
	reason = []
	}).

-record(security_group_info,{
	owner_id = [],
	group_name = [],
	group_desc = [],
	ip_permissions = []
	}).

-record(ip_permissions,{
	ip_protocol =[],
	from_port = [],
	to_port = [],
	groups = []
	}).















